package com.example.yjwj.slice;

import com.example.yjwj.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;

public class MainAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        //. 获取按钮对象
        Button button_01 = (Button)this.findComponentById(ResourceTable.Id_main01);
        //.给按钮对象设盟单击事件
        button_01.setClickedListener(this::clickedListenerButton01);
        //. 获取按钮对象
        Button button_02 = (Button)this.findComponentById(ResourceTable.Id_main02);
        //.给按钮对象设盟单击事件
        button_02.setClickedListener(this::clickedListenerButton02);
        //. 获取按钮对象
        Button button_03 = (Button)this.findComponentById(ResourceTable.Id_main03);
        //.给按钮对象设盟单击事件
        button_03.setClickedListener(this::clickedListenerButton03);
        //. 获取按钮对象
        Button button_04 = (Button)this.findComponentById(ResourceTable.Id_main04);
        //.给按钮对象设盟单击事件
        button_04.setClickedListener(this::clickedListenerButton04);
        //. 获取按钮对象
        Button button_05 = (Button)this.findComponentById(ResourceTable.Id_main05);
        //.给按钮对象设盟单击事件
        button_05.setClickedListener(this::clickedListenerButton05);
    }
    //就转到第一个页面
    private void clickedListenerButton01 (Component component) {
// : 创理意图对家
        Intent intent = new Intent();
        this.present(new MainAbilitySlice01(),intent);
    }
    //就转到第一个页面
    private void clickedListenerButton02 (Component component) {
// : 创理意图对家
        Intent intent = new Intent();
        this.present(new MainAbilitySlice02(),intent);
    }
    //就转到第一个页面
    private void clickedListenerButton03 (Component component) {
// : 创理意图对家
        Intent intent = new Intent();
        this.present(new MainAbilitySlice03(),intent);
    }//就转到第一个页面
    private void clickedListenerButton04 (Component component) {
// : 创理意图对家
        Intent intent = new Intent();
        this.present(new MainAbilitySlice04(),intent);
    }
    //就转到第一个页面
    private void clickedListenerButton05 (Component component) {
// : 创理意图对家
        Intent intent = new Intent();
        this.present(new MainAbilitySlice05(),intent);
    }
    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
